﻿using System;
using System.Collections.Generic;
using System.Text;
using EASM_Language;
using System.IO;

namespace EASM___New_Demo
{
    class Program
    {
        static void Main(string[] args)
        {
            EASM.RegisterMnemonic(typeof(Print));
            if (File.Exists("code.easm"))
            {
                EASM.ExecuteFile("code.easm");
            }
            else
            {
                string code = "def notfound,[The file 'code.easm' was not found.]\nmov ecx, [ERROR: ]\nint 01h\nmov ecx, {notfound}\nint 01h";
                EASM.Execute(code);
            }
            Console.ResetColor();
            Console.WriteLine(Environment.NewLine + "Press any key to continue....");
            Console.ReadKey();
        }
    }
    class Print : Mnemonic
    {
        public override string GetName()
        {
            return "print";
        }
        public override void OnCall(params object[] args)
        {
            Console.WriteLine(EASM.GetAbsoluteValue(args[0].ToString()));
        }
    }
}
